﻿jQuery(document).ready(function () {
     jQuery('#LoadingImage').dialog({
        title: 'Uploading!',
        width: 235,
        height: 237,
        closed: true,
        cache: false,
        modal: true,

    });

    jQuery('#ajaxUploadMat')
    .ajaxForm({
        beforeSubmit: showLoading,
        url: '/api/Upload/PostFileMaterial/', // or whatever
        dataType: 'json',
        success: function (response) {
            stopLoading();
            alert(response);
        }
    });

    jQuery('#ajaxUploadMinMax')
    .ajaxForm({
        beforeSubmit: showLoading,
        url: '/api/Upload/PostFileMinMax/', // or whatever
        dataType: 'json',
        success: function (response) {
            stopLoading();
            alert(response);
        }
    });

    jQuery('#ajaxUploadMatBranch')
    .ajaxForm({
        beforeSubmit: showLoading,
        url: '/api/Upload/PostFileMatBranch/', // or whatever
        dataType: 'json',
        success: function (response) {
            stopLoading();
            alert(response);
        }
    });

    jQuery('#ajaxUploadBranch')
    .ajaxForm({
        beforeSubmit: showLoading,
        url: '/api/Upload/PostFileBranch/', // or whatever
        dataType: 'json',
        success: function (response) {
            stopLoading();
            alert(response);
        }
    });

    function showLoading() {
        $('#LoadingImage').dialog('open');
    }

    function stopLoading() {
        $('#LoadingImage').dialog('close');
    }
});

